import { GaRegExp, ruleInject, ruleInjectable } from "../InjectionRule";
import { blankRemove } from "../methods/blank-remove";

@ruleInjectable()
export default class forRule extends GaRegExp {

	@ruleInject() private calcRule!: GaRegExp;

	@ruleInject() private variableCreatedlRule!: GaRegExp;

	@ruleInject() private executeRule!: GaRegExp;

	public RuleInit() {
		this.ParseRule([
			"for", this.Supply("FOR"), blankRemove,
			"\\(", "(", blankRemove,
			"(&", this.variableCreatedlRule, ")?", ";", blankRemove,
			"(&", this.calcRule, ")?", ";", blankRemove,
			"(&", this.calcRule, "|", this.variableCreatedlRule, ")?", blankRemove,
			")", "\\)", blankRemove,
			"\\{", "(", this.executeRule, ")", "\\}"
		]);
	}

}
